package com.zh.juc.completablefuture;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.util.concurrent.CompletableFuture;

/**
 * @Author: zhanghuan
 * @date: 2022/10/6 20:34
 * @description: create it
 */
public class CompletableFutureMallDemo {

    public static void main(String[] args) {

//        Student student = new Student();
//        student.setId(1);
//        student.setStudentName("san");
//        student.setMajor("english");
//        student.setId(2).setStudentName("lisi").setMajor("cs");
        CompletableFuture<String> completableFuture = CompletableFuture.supplyAsync(() -> {
            return "hello";
        });
        // join编译期间不错检查
        System.out.println(completableFuture.join());
    }
}

@AllArgsConstructor
@NoArgsConstructor
@Data
@Accessors(chain = true)
class Student {
    private Integer id;
    private String studentName;
    private String major;
}
